﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
using StreetlightGames.XnaEngine;

namespace StreetlightGames.SpaceShooter.Patterns
{
    [DataContract]
    public class ContinueForward : MoveToTarget
    {
        /// <summary>Gets or sets the Distance value</summary>
        [DataMember]
        public float Distance
        {
            get { return _distance; }
            set { _distance = value; }
        }
        private float _distance;

        public ContinueForward()
        {
        }

        public ContinueForward(float distance)
        {
            Distance = distance;
        }

        public override void Start()
        {
            Vector3 direction = Ship.Velocity;
            direction.Normalize();
            Target = Ship.Position + direction * Distance;
        }

        public override string ToString()
        {
            return string.Format("Continue Forward: Distance:{0:0.0}", Distance);
        }
    }
}
